import request from "@/http/http"

// 定义ResponseData接口
export interface ResponseData<T> {
  Code: number;
  Data: T;
  IsSucc: boolean;
  Msg: string;
}

// 会议审批列表查询参数
export interface MeetingApprovalListParams {
  pageIndex: number;
  pageSize: number;
  Subject?: string;
  MeetingRoomName?: string;
  MeetingDate?: string;
  UserId?: string;
}

// 会议审批项
export interface MeetingApprovalItem {
  MeetingApprovalId: number;
  MeetingReservationId: number;
  Result: number | null;
  ApprovalThing: string | null;
  State: number;
  UserId: string;
  Subject: string;
  MeetingRoomId: number;
  MeetingRoomName: string;
  HostId: string;
  HostName: string;
  MeetingDate: string;
  StartTime: string;
  EndTime: string;
  Participants: string;
  Content: string;
  RequireSignIn: boolean;
  AccessControlEnabled: boolean;
  SendSmsNotification: boolean;
  IsRemoteMeeting: boolean;
  Status: number;
}

// 分页数据
export interface MeetingApprovalListData {
  Data: MeetingApprovalItem[];
  TotalCount: number;
  TotalPage: number;
}

// 提交审批参数
export interface SubmitApprovalParams {
  MeetingApprovalId: number;
  Result: string;
  ApprovalThing: string;
  UserId: string;
}

/**
 * 获取会议审批列表
 * @param params 查询参数
 * @returns 会议审批列表
 */
export function getMeetingApprovalList(params: MeetingApprovalListParams) {
  return request<ResponseData<MeetingApprovalListData>>({
    url: 'BaseDataReadAPI/MeetingApproval/GetMeetingApprovalList',
    method: 'get',
    params
  })
}


/**
 * 提交会议审批
 * @param data 审批参数
 * @returns 提交结果
 */
export function submitMeetingApproval(data: SubmitApprovalParams) {
  return request<ResponseData<any>>({
    url: 'BaseDataWriteAPI/MeetingApproval/ApprovalProcess',
    method: 'post',
    data
  })
} 

/**
 * 重新提交会议审批
 * @param MeetingReservationId 会议预约ID
 * @returns 重新提交结果
 */
export function approvalResubmit(MeetingReservationId:number) {
  return request<ResponseData<any>>({
    url: 'BaseDataWriteAPI/MeetingApproval/ApprovalResubmit',
    method: 'post',
    params:{
      MeetingReservationId:MeetingReservationId
    }
  })
} 